<div class="container main" ng-controller="LeadListCtrl">
    <!-- 顶部功能区 -->
    <div class="row">
        <div class="panel panel-default">
            <!-- Default panel contents -->
            <div class="panel-heading">
                <div class="text-center"><strong>{[moduleTitle|uppercase]}</strong></div>
                <div class="row">
                    <div class="row">
                        <div class="col-md-4">
                            <span class="btn-group">
                                <button data-toggle="dropdown" class="btn btn-default dropdown-toggle">
                                    <strong>Actions</strong>&nbsp;&nbsp;<i class="caret"></i>
                                </button>

                                <ul class="dropdown-menu">
                                    <li>
                                        <a ng-click="removeSelectedList(objects, query)" href="javascript:void(0);">Delete</a>
                                    </li>
                                    <li class="divider"></li>
                                    <li>
                                        <a onclick="" href="javascript:void(0);">Import</a>
                                    </li>
                                    <li>
                                        <a onclick="" href="javascript:void(0);">Export</a>
                                    </li>
                                </ul>
                            </span>
                            <span class="btn-group">
                                <button class="btn btn-primary pull-left" ng-click="addNew()">
                                    <i class="glyphicon glyphicon-plus icon-white"></i> Add
                                </button>
                            </span>
                        </div>

                        <div class="col-md-8">
                            <form name="form_query" ng-submit="query()" class="form-inline pull-right">
                                <div class="form-group">
                                    <label class="sr-only"></label>
                                    <input type="text" class="form-control" ng-model="parameters.query" placeholder="Keywords" />
                                </div>
                                <div class="form-group">
                                    <label class="sr-only"></label>
                                    <select class="form-control" name="limit" ng-model="parameters.limit">
                                        <option value="20">20</option>
                                        <option value="30">30</option>
                                        <option value="50">50</option>
                                        <option value="100">100</option>
                                        <option value="0">Unlimited</option>
                                    </select>
                                </div>
                                <button type="submit" class="btn btn-info"> <i class="glyphicon glyphicon-search icon-white"></i> Search</button>
                            </form>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Table -->
            <div ng-show="objects.length == 0" class="rounded_corners no_result">
                <p>No Leads found. <a href="javascript:void(0)" ng-click="addNew()">Create Lead</a> </p>
            </div>
            <table class="table table-striped table-bordered table-condensed table-hover" ng-show="objects.length > 0" ts-wrapper>
                <thead>
                    <tr>
                        <th>
                            <select-all-checkbox checkboxes="objects" all-selected="AllSelectedItems"
                            all-clear="NoSelectedItems"></select-all-checkbox>
                        </th>
                        <th>#</th>
                        <th ts-criteria="">First Name</th>
                        <th ts-criteria="">Last Name</th>
                        <th ts-criteria="">Company</th>
                        <th ts-criteria="">Primary Phone</th>
                        <th ts-criteria="">Website</th>
                        <th ts-criteria="">Primary Email</th>
                        <th ts-criteria="">Assigned To</th>
                        <th></th>
                    </tr>
                </thead>
                <tbody>
                    <tr ng-repeat="obj in objects" ts-repeat="ts-repeat">
                        <td class="text-center">
                            <input type="checkbox" ng-model="obj.isSelected" />
                        </td>
                        <td> <a href="javascript:void(0)" ng-click="openLeadDetail(obj.id)">{[ obj.slug ]}</a> </td>
                        <td class="text-right editable-width-1 editable-button-1">
                            <a href="javascript:void(0)" editable-text="obj.first_name" onbeforesave="patchDetail('leads', obj.id, {first_name: $data})">
                                {[ obj.first_name || 'empty' ]}
                            </a>
                        </td>
                        <td class="text-right editable-width-1 editable-button-1">
                            <a href="javascript:void(0)" editable-text="obj.last_name" onbeforesave="patchDetail('leads', obj.id, {last_name: $data})">
                                {[ obj.last_name || 'empty' ]}
                            </a>
                        </td>
                        <td class="text-right editable-width-1 editable-button-1">
                            <a href="javascript:void(0)" editable-text="obj.company" onbeforesave="patchDetail('leads', obj.id, {company: $data})">
                                {[ obj.company || 'empty' ]}
                            </a>
                        </td>
                        <td class="text-right editable-width-1 editable-button-1">
                            <a href="javascript:void(0)" editable-text="obj.primary_email" onbeforesave="patchDetail('leads', obj.id, {primary_email: $data})">
                                {[ obj.primary_email || 'empty' ]}
                            </a>
                        </td>
                        <td class="text-right editable-width-1 editable-button-1">
                            <a href="javascript:void(0)" editable-text="obj.primary_phone" onbeforesave="patchDetail('leads', obj.id, {primary_phone: $data})">
                                {[ obj.primary_phone || 'empty' ]}
                            </a>
                        </td>
                        <td class="text-right editable-width-1 editable-button-1">
                            <a href="javascript:void(0)" editable-text="obj.website" onbeforesave="patchDetail('leads', obj.id, {website: $data})">
                                {[ obj.website || 'empty' ]}
                            </a>
                        </td>
                        <td class="text-right">{[ obj.assigned_to_title ]}</td>
                        <td class="text-right">
                            <button type="button" class="btn btn-primary btn-xs" ng-click="edit(obj.id)">Edit</button>
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
    </div>
    <div ng-include="'/static/js/views/components/pager.html'" style="display: inline;"></div>

</div>